﻿<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%String path = request.getContextPath(); %> 
<!DOCTYPE html>
<html>
<head>
<title>用户注册</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<link href="<%=path%>/resources/css/pages/style.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/resources/css/pages/xcConfirm.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path%>/resources/script/js/jquery-1.8.0.min.js" ></script>
<jsp:include page="/WEB-INF/views/common.jsp"></jsp:include>
<script  type="text/javascript" src="<%=path%>/resources/script/js/vue.js"></script>
<script type="text/javascript" src="<%=path%>/resources/script/js/js.js" ></script>
<script type="text/javascript" src="<%=path%>/resources/script/js/xcConfirm.js" ></script>
<script type="text/javascript">
	$(function(){ 
		$('#btnSendCode').click(function() {
			alert("testetst");
		}); 
	});
</script>
</head>
<body>
<div id="contentBody">
<div class="top">
  <div class="top-ct">
   <h3 class="logo"></h3> 
   <span id='span'>
       <a href="<%=path%>/pages/login" id='plogin'><span >您好，请登录！</span></a>
       <a href="<%=path%>/pages/userInfo?userid=${loginUser.id}" id='pshow'><span></span></a>
    </span>
   <p>
		<a href="<%=path%>/index">首页</a>
		<a href="<%=path%>/pages/mycourse?userid=">我的课程</a>
		<a href="<%=path%>/pages/learnhistory?userid=">学习历史</a>
		<a href="javascript:void(0);">我的技能</a>
	</p>
    </div>
</div>
<div class="ny-login">
  <div class="register">
  <form id="form" method="post">
  <!--  <label><input id="jbPhone" type="text" class="tel" name="tel" placeholder="输入手机号"> <a id="btnSendCode" onclick="sendMessage()" class="yzm"></a></label>
    <label><input type="text" class="yzm" name="yzm" placeholder="输入验证码"></label>
    <label><input type="password" class="dlmm" name="dlmm" placeholder="设置登录密码"></label>
    <label><input type="password" class="qrmm" name="qrmm" placeholder="确认登录密码"></label>
     <label> <input type="submit" class="tjan" value="注册"></label>  -->
     <label><span class="usericon"></span><input id="account" type="text" class="tel" name="account" placeholder="用户账号"></label>
     <label><span class="emailicon"></span><input id="email" type="email" class="emai" name="email" placeholder="用户邮箱"></label>
     <label><span class="pwdicon"></span><input id="pwd1" type="text" class="dlmm" name="pwd1" placeholder="设置登录密码" onfocus="this.type='password'"></label>
     <label><span class="pcficon"></span><input id="pwd2" type="text" class="qrmm" name="pwd2" placeholder="确认登录密码" onfocus="this.type='password'"></label>
     <label> <input type="button" id="tjan" class="tjan" value="注册"></label>
  </form>
</div>

</div>
<div class="foot-ct1"><p>Copyright © 2016 业主单位：福建工程学院，建设单位：福州森泽信息科技有限公司 技术服务热线：87862229
</p></div>
<div class="clear"></div>
</div>
<script type="text/javascript"  language="JavaScript">
  $("#tjan").click(function(){
		if($("#account").val()=="")
		{
			window.wxc.xcConfirm("请输入用户账号!", window.wxc.xcConfirm.typeEnum.info,{
				onOk:function(){
					$("#account").focus();
				}
			});
		    return false;
		}
		if($("#email").val()=="")
		{
			window.wxc.xcConfirm("请输入邮箱账号!", window.wxc.xcConfirm.typeEnum.info,{
				onOk:function(){
					$("#email").focus();
				}
			});
		    return false;
		}
		else{
			var myvar=/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
			if(!myvar.test($("#email").val())){
				window.wxc.xcConfirm("请输入正确的邮箱格式！", window.wxc.xcConfirm.typeEnum.info,{
					onOk:function(){
						$("#email").focus();
					}
				});
			    return false;
			}
		}
		if($("#pwd1").val()=="")
		{
			window.wxc.xcConfirm("请输入密码!", window.wxc.xcConfirm.typeEnum.info,{
				onOk:function(){
					$("#pwd1").focus();
				}
			});
		    return false;
		}
		if($("#pwd2").val()=="")
		{
			window.wxc.xcConfirm("请输入确认密码!", window.wxc.xcConfirm.typeEnum.info,{
				onOk:function(){
					$("#pwd2").focus();
				}
			});
		    return false;
		}
		 if($("#pwd1").val()!=$("#pwd2").val())
	   	{
	   	    window.wxc.xcConfirm("两次输入的密码不一致!", window.wxc.xcConfirm.typeEnum.info,{
	   	    	onOk:function(){
					
				}
	   	    });
	   	    return false;
	   	}
   
	    $('#form').ajaxSubmit({
			url : '<%=path%>/pages/registUser',
			success:function(result) {
			if (!result.result) {
				window.wxc.xcConfirm(result.msg, window.wxc.xcConfirm.typeEnum.info,{
					onOk:function(){
						$("#account").focus();
					}
				});
				return false;
			} else {
				window.wxc.xcConfirm(result.msg, window.wxc.xcConfirm.typeEnum.success,{
					onOk:function(){
						location.href = '<%=path%>/pages/login';
					}
				  });
				}
			}
		});
});
    
</script>
</body>
</html>
